<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>快速投票</title>
  <link rel="stylesheet" href="/styles.css" />
  <script defer src="/vote.js"></script>
</head>
<body>
  <header>
    <h1>请选择支持的候选人</h1>
    <p>点击姓名进行投票，每次点击代表一票。</p>
  </header>
  <main>
    <section class="vote-card">
      <h2>候选人列表</h2>
      <div id="voteOptions" class="vote-options"></div>
      <div id="feedback" class="feedback"></div>
      <p class="notice">投票结果将在大屏幕实时刷新。若投票已截止，将无法提交。</p>
      <p class="notice" id="screenLinkWrap">大屏地址：<a id="screenLink" href="/scoreboard.html">/scoreboard.html</a></p>
      <script>
        // 自动根据 voteId 拼接大屏地址
        (function() {
          var params = new URLSearchParams(window.location.search);
          var vid = params.get('voteId');
          if (vid) {
            var link = document.getElementById('screenLink');
            link.href = '/scoreboard.html?voteId=' + encodeURIComponent(vid);
            link.textContent = '/scoreboard.html?voteId=' + vid;
          }
        })();
      </script>
    </section>
  </main>
</body>
</html>
